import 'package:get/get.dart';
import 'package:kkhousekeep/page/login/login_controller.dart';
import 'package:kkhousekeep/page/me/face_photo.dart';
import 'package:kkhousekeep/tools/shared_preferences.dart';
import 'package:kkhousekeep/tools/toast_util.dart';
import 'package:shared_preferences/shared_preferences.dart';

class SettingController extends GetxController {
  var userType = UserType.owner.obs;

  @override
  void onInit() {
    super.onInit();
    SharedPreferences.getInstance()
        .getUserType()
        .then((value) => userType.value = value);
  }

  void buildFacePage() async {
    var checkPass = await getSp().getRoomCheckPass();
    var userType = await getSp().getUserType();
    if (userType != UserType.property && !checkPass) {
      ToastUtils.showToast(tip: "绑定房屋后解锁更多功能");
      return;
    }
    Get.to(() => const FacePhoto());
  }
}
